package com.hongpu.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 项目的回款与支出
 * @TableName hp_project_work_pay
 */
@TableName(value ="hp_project_work_pay")
@Data
public class HpProjectWorkPay implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    /**
     * 项目名称
     */
    @TableField(value = "project_name")
    private String projectName;

    @TableField(value = "project_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long projectId;

    /**
     * 项目收支类型：0收入 1支出
     */
    @TableField(value = "income_and_expenditure_types")
    private String incomeAndExpenditureTypes;

    /**
     * 合同总金额
     */
    @TableField(value = "total_contract_amount")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    private BigDecimal totalContractAmount =  BigDecimal.ZERO;



    /**
     * 已支付总额 或 已收款总额
     */
    @TableField(exist = false)
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    private BigDecimal totalAmountPaid =  BigDecimal.ZERO;
    /**
     * 未支付总额 或 未收款总额
     */
    @TableField(exist = false)
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    private BigDecimal totalAmountUnpaid =   BigDecimal.ZERO;


    /**
     * 对方单位(保留字段）
     */
    @TableField(value = "opposing_unit")
    private String opposingUnit;

    /**
     * 数据保存时间
     */

/*
    @TableField(value = "create_time",fill = FieldFill.INSERT_UPDATE)
    private Date createTime;
*/

    /**
     * 数据生成时间
     */
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    /**
     * 数据修改时间
     */
    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    /**
     * 数据生成操作人ID
     */
    @TableField(value = "create_by",fill = FieldFill.INSERT)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long createBy;

    /**
     * 数据修改操作人ID
     */
    @TableField(value = "update_by",fill = FieldFill.UPDATE)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long updateBy;

    /**
     * 数据逻辑删除标识
     */
    @TableField(value = "deleted",fill = FieldFill.INSERT)
    @TableLogic
    private Integer deleted;

    /**
     * 租户ID
     */
    @TableField(value = "tenant_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long tenantId;





    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private List<HpProjectWorkPayList> hpProjectWorkPayLists;


    /**
     * 增值税总额
     */
    @TableField(exist = false)
    private BigDecimal totalValueAddedTax =  BigDecimal.ZERO;
    /**
     * 普通税总额
     */
    @TableField(exist = false)
    private BigDecimal totalAmountOfOrdinaryTax =  BigDecimal.ZERO;

    /**
     * 当前页
     */
    @TableField(exist = false)
    private Long current;
    /**
     * 每页显示条数
     */
    @TableField(exist = false)
    private Long size;


    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        HpProjectWorkPay other = (HpProjectWorkPay) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getProjectName() == null ? other.getProjectName() == null : this.getProjectName().equals(other.getProjectName()))
            && (this.getIncomeAndExpenditureTypes() == null ? other.getIncomeAndExpenditureTypes() == null : this.getIncomeAndExpenditureTypes().equals(other.getIncomeAndExpenditureTypes()))
            && (this.getTotalContractAmount() == null ? other.getTotalContractAmount() == null : this.getTotalContractAmount().equals(other.getTotalContractAmount()))
            && (this.getOpposingUnit() == null ? other.getOpposingUnit() == null : this.getOpposingUnit().equals(other.getOpposingUnit()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getProjectName() == null) ? 0 : getProjectName().hashCode());
        result = prime * result + ((getIncomeAndExpenditureTypes() == null) ? 0 : getIncomeAndExpenditureTypes().hashCode());
        result = prime * result + ((getTotalContractAmount() == null) ? 0 : getTotalContractAmount().hashCode());
        result = prime * result + ((getOpposingUnit() == null) ? 0 : getOpposingUnit().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", projectName=").append(projectName);
        sb.append(", incomeAndExpenditureTypes=").append(incomeAndExpenditureTypes);
        sb.append(", totalContractAmount=").append(totalContractAmount);
        sb.append(", opposingUnit=").append(opposingUnit);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}